OpenGL 1.1 offers three texture environments: GL_MODULATE, GL_BLEND, and GL_ REPLACE (see "New Ways of Using Texture Environments"). The texture environments allow a program to use the values in the texture map to change (or replace) the color that would be painted without texturing.
The index texture extension, SGI_index_texture, supports two additional texture modes. It also allows you to use texturing in color index mode (which is not allowed in standard OpenGL). The extension provides these features:
You may specify a texture palette (the color table associated with a texture object) with a color index internal format. A texture palette is applied only to texture images if one of these conditions is met:
If mipmapping is used, then all mipmap levels must be specified with the same internal format.
The code sample below illustrates how the extension is used. A complete example is provided in Appendix A, "Code Example for Index Texture Extension".
GLubyte texture[16] = { 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, }; glTexImage2d(GL_TEXTURE_2D, 0, GL_COLOR_INDEX8_EXT, 4, 4, 0, GL_COLOR_INDEX, GL_UNSIGNED_BYTE, texture);
Note that in this example, GL_COLOR_INDEX8_EXT is used as a texture internal format. In addition, just as specified in "The Paletted Texture Extension," texels are loaded using the color index pixel transfer path when the texture internal format is a color index format.
When the extension is available, a new base internal format, COLOR_INDEX, is available for which three texture environments are defined as follows:
Base Internal Format | REPLACE | MODULATE | DECAL | BLEND | ADD |
---|---|---|---|---|---|
... | undefined | ||||
COLOR_INDEX | Iv = It | Iv = If * It | undefined | undefined | Iv = If + It |
... | undefined |